<template>
  <div class="agent">
    <div class="agent-nodata" v-if="agentList.length==0">
      <div class="agent-nodata-content">
        <img src="../../assets/agent/nodata.png" alt="">
        <p>还没有内容哦～</p>
      </div>
    </div>
    <div class="agent-content" v-else>
      <div class="agent-search">
        <input type="text" placeholder="姓名/手机号">
        <div class="agent-search-btn"><img src="../../assets/agent/search.png" alt=""></div>
      </div>
      <div class="agent-row" v-for="(data,index) in agentList" :key="index">
        <div class="agent-row-title">
          {{data.name}}<span>{{data.childName}}</span>
        </div>
        <div class="agent-row-content">
          <div class="agent-row-item">
            <p>{{data.phone}}</p>
            <span>提成比例：{{data.proportion}}%</span>
          </div>
          <div class="agent-row-item">
            <p>设备：{{data.equipment}}</p>
            <span>总收益：{{data.profit}}万</span>
          </div>
          <div class="agent-row-item">
            <p>上级：{{data.upName}}</p>
            <nut-switch :active="data.isClick" class="my-switch">
            </nut-switch>
          </div>
        </div>
        <div class="agent-footer" @click="goShop">
          <p>酒店数：{{data.shopNumber}}</p>
          <img src="../../assets/agent/right.png" alt="">
        </div>
      </div>
      <img class="addBtn" src="../../assets/agent/add.png" @click="add">
    </div>
  </div>
</template>

<script>
  export default {

    data() {
      return {
        agentList: [{
            name: "重庆郭德纲",
            childName: "分红代理",
            phone: "18888888888",
            proportion: "20",
            equipment: "卡布达一号",
            profit: "20",
            upName: "阿里巴巴",
            shopNumber: 66,
            isClick: false,
          },
          {
            name: "重庆郭德纲",
            childName: "分红代理",
            phone: "18888888888",
            proportion: "20",
            equipment: "卡布达一号",
            profit: "20",
            upName: "腾讯",
            shopNumber: 66,
            isClick: true,
          }
        ],
      }
    },
    mounted() {
      document.title = "分红代理"
    },
    methods: {
      goShop() {
        this.$router.push("/shop")
      },
      add() {
        this.$router.push("/dividend")
      },
    }
  };
</script>

<style lang="less" scoped>
  .agent {
    .agent-nodata {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 60vh;

      .agent-nodata-content {
        p {
          padding: 0;
          margin: 0;
          height: 16px;
          font-size: 16px;
          font-family: Adobe Heiti Std;
          font-weight: normal;
          color: #999999;
          text-align: center;
        }

        img {
          width: 245px;
          margin: 0 auto;
        }
      }

    }

    .agent-content {
      box-sizing: border-box;
      padding: 18px 16px;

      .agent-search {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        background: #fff;
        border-radius: 20px;
        height: 33px;
        overflow: hidden;
        background-color: #E5E5E5;

        input {
          height: 33px;
          border: 0;
          outline: none;
          width: 100%;
          padding-left: 20px;
          box-sizing: border-box;
          background: transparent;
        }

        .agent-search-btn {
          min-width: 69px;
          height: 33px;
          display: flex;
          justify-content: center;
          align-items: center;
          background-color: #fff;

          img {
            width: 23px;
          }

        }
      }

      .agent-row {
        margin-top: 11px;
        background: #FFFFFF;
        box-shadow: 0px 0px 9px 0px rgba(51, 51, 51, 0.09);
        border-radius: 5px;
        padding: 0 12px;

        .agent-row-title {
          padding: 17px 0 9px 0px;
          font-size: 16px;
          color: #1677FF;
          font-weight: bold;
          border-bottom: 1px solid #eee;

          span {
            font-size: 12px;
            color: #999999;
            margin-left: 15px;
          }
        }

        .agent-row-content {
          padding: 9px 0;
          border-bottom: 1px solid #eee;
          font-weight: bold;

          .agent-row-item {
            display: flex;
            justify-content: space-between;
            align-items: center;

            color: #333333;
            font-size: 14px;

            p {
              margin: 0;
              padding: 9px 0;
            }
          }
        }

        .agent-footer {
          font-size: 14px;
          font-weight: bold;
          display: flex;
          align-items: center;
          justify-content: space-between;
          padding: 17px 0;

          p {
            padding: 0;
            margin: 0;
          }

          img {
            width: 20px;
          }
        }
      }

      .addBtn {
        width: 66px;
        height: 66px;
        position: fixed;
        bottom: 55px;
        right: 11px;
        z-index: 6;
      }
    }
  }


  .nut-switch.nut-switch-active {
    background-color: #1677FF;
    border-color: #1677FF;
  }

  .nut-switch-base {
    background-color: #999999;
    border-color: #999999;
  }

  @media screen and (min-width: 300px)and (max-width: 320px) {
    .agent .agent-content .agent-search {
      height: 28px;
    }
    .agent .agent-content .agent-search{
       height: 28px;
    }
    .agent .agent-content .agent-search .agent-search-btn{
      height: 28px;
    }
    .agent .agent-content .agent-search .agent-search-btn img{
      width:19px;
    }
  }
</style>
<style>
  .nut-switch.nut-switch-active .nut-switch-btn {
    background-color: #fff;
  }

  .nut-switch .nut-switch-btn {
    background-color: #fff;
  }
</style>
